asEventSinkFunction

A helper function for creating a function wrapper around this TestEventSink for use in tests as an event sink function. We have to do this workaround in JS due to Kotlin/JS not allowing function type extension directly.